import json

import yaml

data1 = {
    "数字": [1, -1, 1.2, ],
    "字符串": ["1", '-1', """1.2"""],
    "布尔值": [True, False],
    "空值": None,
    '列表': [[1, 2, 3], [-1, -2, -3]],
    "字典": [{"a": 1}, {"b": 2}],
}
data = [
    (1, 2, 3),
    (2, 3, 5),
    (5, 5, 5)
]
# 把Python数据转为json文件
s = json.dumps(data, ensure_ascii=False)
print(s)
with open("../data/data.json", "w", encoding="utf-8") as f:
    f.write(s)

# 把Python数据转为yaml文件
s = yaml.safe_dump(data, allow_unicode=True, sort_keys=False)
print(s)
with open("../data/data.yaml", "w", encoding="utf-8") as f:
    f.write(s)
